/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.jebert.javamessage.control;

import java.net.ServerSocket;
import java.net.Socket;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.processing.Messager;
import org.jebert.javamessage.model.Contact;
import org.jebert.javamessage.view.ChatWindow;
import org.jebert.javamessage.view.ContactList;

/**
 *
 * @author jebert
 */
public class MessageListener extends Thread {

    private ContactList contactList;

    public MessageListener(ContactList conlist) {

        this.contactList = conlist;

    }

    @Override
    public void run() {
        while (true) {
            try {
                ServerSocket ss = new ServerSocket(7000);
                Socket s = ss.accept();
                MessageServer ms = new MessageServer(s, contactList);
                ms.run();
                sleep(1000);
                System.out.println("Recebido mlistener");
            } catch (Exception e) {
                Logger.getLogger(MessageListener.class.getName()).log(Level.SEVERE, null, e);
            }
        }
    }
}
